#include <iostream>
#include <cstring>
using namespace std;

class Solution {
public:
    void replaceSpace(char *str, int length) {
        int spaceCount = 0;
        for (int index = 0; index != length; ++index) {
            spaceCount += str[index] == ' ';
        }
        for (int index = length - 1; index >= 0; --index) {
            if (str[index] == ' ') {
                str[index + spaceCount * 2] = '0';
                str[index + spaceCount * 2 - 1] = '2';
                str[index + spaceCount * 2 - 2] = '%';
                spaceCount--;
            } else {
                str[index + spaceCount * 2] = str[index];
            }
        }
    }
};

int main() {
    char str[20] = " HelloWorld\0";
    Solution().replaceSpace(str, strlen(str));
    cout << str << endl;
    return 0;
}